package com.example.content.repository.oprators

import com.example.content.ACCESS_TOKEN
import com.example.content.viewmodule.login.TokenStore
import okhttp3.Authenticator
import okhttp3.Request
import okhttp3.Response
import okhttp3.Route

/**
 * Created by zhudongao
 * Desc
 * Date 2020/11/11
 */
class TokenAuthenticator:Authenticator {
    override fun authenticate(route: Route?, response: Response): Request? {
        // TODO: 2020/11/11  refresh_token获取access_token
        if (true) {
            return null
        }

        return response.request
            .newBuilder()
            .addHeader(ACCESS_TOKEN, TokenStore.token)
            .build()
    }
}